🎖️GitЯра🎖️
Commit 37e9e2c8f0f5c5708bf965df43636556a8121c40
Parents : 9c8532f
Author : James Rich <2199651+jamesarich@users.noreply.github.com>
Signature : Signature validation error
Date : 2026-04-10T19:05:56-05:00
Committer : GitHub <noreply@github.com>
Date : 2026-04-11T00:05:56Z
fix(charts): hoist rememberVicoZoomState above vararg layers to prevent ClassCastException (#5060)
Changes
1 files changed, 6 insertions(+), 1 deletions(-)
Diff
diff --git a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/BaseMetricChart.kt b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/BaseMetricChart.kt
index 0b9f400446..cb96607d93 100644
--- a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/BaseMetricChart.kt
+++ b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/metrics/BaseMetricChart.kt
@@ -96,6 +96,11 @@ fun GenericMetricChart(
onPointSelected: ((Double) -> Unit)? = null,
vicoScrollState: VicoScrollState = rememberVicoScrollState(),
) {
+ // Hoist zoom state above rememberCartesianChart so that the variable slot count
+ // from the vararg layers spread does not shift this remember call during recomposition
+ // (toggling legend chips changes the layer count, which corrupts the slot table).
+ val zoomState = rememberVicoZoomState(zoomEnabled = true, initialZoom = Zoom.Content)
+
val markerVisibilityListener =
remember(onPointSelected) {
object : CartesianMarkerVisibilityListener {
@@ -126,7 +131,7 @@ fun GenericMetricChart(
modelProducer = modelProducer,
modifier = modifier,
scrollState = vicoScrollState,
- zoomState = rememberVicoZoomState(zoomEnabled = true, initialZoom = Zoom.Content),
+ zoomState = zoomState,
)
}
Served by rngit 1.5.2 - Generated in 0.32s